<?php
namespace app\api\controller\auth;

use app\api\controller\Api;
use app\common\system\logic\FormLogic;

class Form extends Api
{
    // 一个用户一个表单只能有一个token
    public function token()
    {
        $post = $this->request->post();
        if (empty($post['api'])) return error([], "缺少API参数");
        $user = $this->request->user;
        $formLogic = new FormLogic();

        $result['token'] = $formLogic->buildToken($user['id']);
        return success($result, "获取表单成功");
    }
}